import { lazy, Suspense } from "react";
import { BrowserRouter, useRoutes } from "react-router-dom";
const Home = lazy(() => import("../views/home"));
const UploadImage = lazy(() => import("../views/uploadImage"));
const UploadImage1 = lazy(() => import("../views/uploadImage1"));
const Upload = lazy(() => import("../views/upload"));
const MainLayout = lazy(() => import("../mainLayout"));
const UploadOss = lazy(() => import("../views/uploadoss"));
const _routes = [
  {
    path: "/",
    element: <MainLayout></MainLayout>,
    children: [
      {
        path: "/",
        element: <Home></Home>,
      },
      {
        path: "/upload/image",
        element: <UploadImage></UploadImage>,
      },
      {
        path: "/upload/image1",
        element: <UploadImage1></UploadImage1>,
      },
      {
        path: "/upload",
        element: <Upload></Upload>,
      },
      {
        path: "/upload/oss",
        element: <UploadOss></UploadOss>,
      },
    ],
  },
];
const Router = () => {
  const App = () => useRoutes(_routes);
  return (
    <BrowserRouter>
      <Suspense>
        <App></App>
      </Suspense>
    </BrowserRouter>
  );
};
export default Router;
